//点击消除
import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();

            Stack<Character> stack = new Stack<>();
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if (stack.empty() || ch != stack.peek()) {
                    stack.push(ch);
                } else {
                    stack.pop();
                }
            }

            if (stack.empty()) {
                System.out.print("0");
            } else {
                //站当中已经存放好了ca
                Stack<Character> stack2 = new Stack<>();
                while (!stack.empty()) {
                    stack2.push(stack.pop());
                }
                while (!stack2.empty()) {
                    System.out.print(stack2.pop());
                }
            }
        }
    }
}